12. Importing Dependencies

Importing Dependencies

ND079 JPND C3 L2 A09 Importing Dependencies V3

Maven Dependencies

Maven can automatically download project dependencies and include them as part of your project build. It stores a single copy of each dependency in its local repository and adds them to the build path when necessary.

Maven dependencies are added to your pom.xml by providing the same unique identifying information that is required in the minimal pom for your own project. Each dependency is a single element in a list of dependencies. This snippet will include the JUnit Jupiter artifact in your project.

<dependencies>
    <dependency>
        <groupId>org.junit.jupiter</groupId>
        <artifactId>junit-jupiter</artifactId>
        <version>5.7.0</version>
    </dependency>
</dependencies>

Dependency: External Java source, often a JAR, that is not part of your program and not part of the Java standard library.

**Maven Dependency Location: **Local copies of Maven dependencies are stored at:

/user/.m2/repository